﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AbstractFactory.ProductSet1
{
    public class ConcreateFactory:IAbstractFactory
    {
        public Type typeA;
        public Type typeB;
        public ConcreateFactory(Type typea,Type typeb)
        {
            this.typeA = typea;
            this.typeB = typeb;
            //通过构造函数来加载实例化的类型，
            //同时每个方法去实例化生成
        }
        public virtual IProductA CreateProductA()
        {
            return (IProductA)Activator.CreateInstance(this.typeA);
        }

        public virtual IProductB CreateProductB()
        {
            return (IProductB)Activator.CreateInstance(this.typeB);
        }
    }
}
